package gdut.imis.controller;

import gdut.imis.Utils.Result;
import gdut.imis.domain.ExamInfo;
import gdut.imis.service.ExamInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

/**
 * @Description
 * @Author JiaFu
 * @Date 2023/4/7 21:45
 */
@RestController
@RequestMapping("/exam-info")
@Api(value = "考试信息档案接口", tags = {"考试信息档案接口"})
@RequiredArgsConstructor
public class ExamInfoController extends BaseController {
    private final ExamInfoService examInfoService;

    @ApiOperation("新增考试信息档案")
    @PostMapping("/addExamInfo")
    @PreAuthorize("@cp.hasPermission('examInfo')")
    public Result addExamInfo(@RequestBody ExamInfo examInfo) {
        return examInfoService.addExamInfo(examInfo);
    }

    @ApiOperation("根据学生id获取学生第一次考试的档案回忆")
    @GetMapping("/getExamMemoryBystuId/{studentId}")
    public Result getExamMemoryBystuId(@PathVariable("studentId") Long studentId){
        return examInfoService.getExamMemoryBystuId(studentId);
    }

}
